package cn.edu.cdu.farmdeal.mapper;

import cn.edu.cdu.farmdeal.domain.Shop;
import cn.edu.cdu.farmdeal.domain.ShopExample;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
@Mapper

public interface ShopMapper {
    /**
     *
     * @param shop
     * @return
     */
    int insertShop(Shop shop);

    List<Shop> selectByName(String shopName);
    /**
     * 价格增加
     * @param id price
     * @return
     */
    int plusCartPrice(@Param("id") int id ,@Param("price") String price);
    /**
     * 价格减少
     * @param price id
     * @return
     */
    int reduceCartPrice(@Param("id") int id ,@Param("price") String price);

    /**
     * 根据cartid查询shop是否重复
     * @param id
     * @return
     */
    List<Shop> selectShop(int id);
    /**
     * 检查重复
     * @param id
     * @param userName
     * @return
     */
    Shop checkPro(String id, String userName);
    /**
     * 删除shop
     * @param shopId
     * @return
     */
    int deleteShop(String shopId);
    /**
     * 获取
     * @param shopId
     * @return int
     */
    int getConuntPro(String shopId);
    /**
     * 获取id
     * @param id
     * @return
     */
    String getShopId(String id);
    /**
     * 点击加1
     * @param id
     * @return
     */
    int plusCart(String id);
    /**
     * 删除某个产品
     * @param id
     * @return
     */
    int deleteCart(String id);

    /**
     * 点击减1
     * @param id
     * @return int
     */
    int reduceCart(String id);

    /**
     * 获得购物车数据
     * @return
     */
    List<Shop> getCart(String userName);

    int countByExample(ShopExample example);

    int deleteByExample(ShopExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Shop record);

    int insertSelective(Shop record);

    List<Shop> selectByExample(ShopExample example);

    Shop selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Shop record, @Param("example") ShopExample example);

    int updateByExample(@Param("record") Shop record, @Param("example") ShopExample example);

    int updateByPrimaryKeySelective(Shop record);

    int updateByPrimaryKey(Shop record);
}